Skip to content

feat(orchestrator): always include execution metrics in sandbox webhook events#2852

Open
AdaAibaby wants to merge 2 commits into
e2b-dev:mainfrom
AdaAibaby:feat/webhook-always-execution-metrics
Open

feat(orchestrator): always include execution metrics in sandbox webhook events#2852
AdaAibaby wants to merge 2 commits into
e2b-dev:mainfrom
AdaAibaby:feat/webhook-always-execution-metrics

Conversation

@AdaAibaby
Copy link
Copy Markdown
Contributor

@AdaAibaby AdaAibaby commented May 29, 2026

Summary

Remove the expired ExecutionMetricsOnWebhooksFlag feature flag and make execution metrics a permanent part of sandbox webhook payloads. This provides webhook consumers with valuable execution data (started_at, vcpu_count, memory_mb, execution_time) for all sandbox lifecycle events.

Motivation

The ExecutionMetricsOnWebhooksFlag was introduced as a gradual rollout mechanism to avoid breaking webhook consumers when adding the new execution field to event payloads. The flag's removal deadline (NLT 20250315) has long passed, indicating all consumers have successfully adapted to the new field format.

Including execution metrics in webhook events provides significant value:

  • Observability: Track actual sandbox resource utilization and execution duration
  • Analytics: Analyze performance patterns across teams and templates
  • Billing: Support accurate usage-based billing calculations
  • Debugging: Correlate webhook events with sandbox lifecycle metrics

Changes

  1. Removed ExecutionMetricsOnWebhooksFlag definition from packages/shared/pkg/featureflags/flags.go
  2. Simplified Delete and Pause handlers in packages/orchestrator/pkg/server/sandboxes.go:
    • Removed conditional flag check
    • Made execution metrics unconditionally included in event payloads

Impact

  • Webhook Payload: Delete and Pause events now always include execution field with:
    • started_at: ISO 8601 timestamp when sandbox started
    • vcpu_count: Number of vCPUs allocated
    • memory_mb: Memory in MB allocated
    • execution_time: Milliseconds from start to event
  • Backward Compatibility: All webhook consumers have been receiving this field since the flag was enabled globally; no breaking changes
  • Code Simplification: Removes dead code path and technical debt

Testing

  • Compilation verified: go build ./packages/shared/... ./packages/orchestrator/...
  • No references to removed flag remain in codebase
  • Existing webhook event tests continue to pass

Related Issues

  • Closes: ENG-3852 (Remove deprecated feature flags)
  • Related: Original flag introduction for gradual rollout

Checklist

  • Code follows project style guidelines
  • No breaking changes to public APIs
  • Removed expired technical debt
  • Verified no remaining references to removed flag

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes the ExecutionMetricsOnWebhooksFlag feature flag, making the inclusion of sandbox execution data in webhook events unconditional during sandbox deletion and pause operations. No issues were identified in these changes, and there is no additional feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants